<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>采购订单</title>

</head>
<body>	
<script type="text/javascript">
$(function(){
	$("#supplier_select_open").textbox({onClickButton: function(){
		$("#supplier_select").window("open");
	}});
	$("#checkedEplan_select_open").textbox({onClickButton: function(){
		$("#checkedEplan_select").window("open");
	}});
});
function saveEquipOrder(){
	$("#from_add_order").form({
		onSubmit: function(){
			var isValid = $(this).form('validate');
			if (!isValid){
				$.messager.progress('close');	// 如果表单是无效的则隐藏进度条
			}
			return isValid;	// 返回false终止表单提交	
		},
		success: function(v){
			var json = eval("(" + v + ")");
			$.messager.alert("操作提示", 
					json.success ? "操作成功" 
					: ("操作失败，原因为：" + json.reason));
			$("#from_add_order").form("clear");
			
			var rows = $("#order_equip_detail_tabs").datagrid("getRows");
			for(var i=rows.length-1;i>=0;i--){
				$('#order_equip_detail_tabs').datagrid('deleteRow', i);
			}
			var rows2 = $("#order_business_people_tabs").datagrid("getRows");
			for(var i=rows2.length-1;i>=0;i--){
				$('#order_business_people_tabs').datagrid('deleteRow', i);
			}
			createEquipOrderId();
		}
	});
	$("#from_add_order").submit();
	
}
</script>
<div class="easyui-panel" data-options="border:false,fit:true,onOpen:createEquipOrderId">
	
	<form id="from_add_order" action="add_EquipOrder_sss" method="post">
	<input name="eplanId" type="hidden" id="checked_eplanId" class="easyui-textbox"> 	
		<table width="100%" border="0" style="padding:6px;">
		<tr>
			<td style="width: 30%;"><input name="eorderId" class="easyui-textbox" label="订单号*" style="width:250px" id="EquipOrderId" readonly="readonly"></td>
			<td style="width: 30%;"><select name="eorderState" class="easyui-combobox" label="状态" style="width:200px" readonly="readonly"
				data-options="panelHeight: 'auto'">
				<option value="已订购">未确认</option>
			</select></td>
		</tr>
		<tr>	
			<td><input id="checkedEplan_select_open" class="easyui-textbox" label="计划选择" data-options="buttonText:'选择',width:300,required:true,validType:'isBlank'"></td>
			<td><input class="easyui-textbox" style="width:60%;" label="部门" id="checked_eplanDept" readonly="readonly"></td>
			<td><input class="easyui-textbox" style="width:60%;" label="制定人" id="checked_eplanAuthor" readonly="readonly"></td>
		</tr>
		<tr>
			<td><input name="busOrdername" id="supplier_select_open" class="easyui-textbox" label="供应商" data-options="buttonText:'选择',width:300,required:true,validType:'isBlank'"></td>		
			<td style="width:30%;"><input style="width:60%;" name="eorderBdate" class="easyui-datebox" label="订货日期" value="1" data-options="required:true,validType:'isBlank'"/></td>	
			<td style="width:30%;"><input style="width:60%;" name="eorderEdate" class="easyui-datebox" label="到货日期" data-options="required:true,validType:'isBlank'"/></td>			
		</tr>		
		<tr>
			<td><input name="eorderName" class="easyui-textbox" label="采购员" data-options="required:true,validType:'isBlank'"></td>
			<td><input name="eopPhone" class="easyui-textbox" label="电话" style="width:200px" data-options="required:true,validType:'phone'"></td>
			<td><input name="eorderAddress" class="easyui-textbox" label="交货地点" style="width:300px" data-options="required:true,validType:'isBlank'"></td>
		</tr>
		</table>
		
		<input name="busId" type="hidden" id="supplier_select_Id" class="easyui-textbox">
	
	<div id="supplier_select" class="easyui-window" title="选择供应商"
			data-options="collapsible:false,minimizable:false,maximizable:false,modal:true,iconCls:'icon-add',closed:true"
			style="width: 800px; height: 400px; padding: 5px;">
		<div style="margin-left: 5px;">
		<div style="margin: 10px">
			类型<select class="easyui-combobox" style="width: 100px;"
				id="orderSave_busType" data-options="panelHeight: 'auto'">
				<option value="供应商">供应商</option>
				
			</select> 
		 	名称<input id="orderSave_busName" style="width: 100px;" class="easyui-textbox"> 			
			地址<input id="orderSave_busAddress" style="width: 100px;" class="easyui-textbox" > 					
			<a href="#" class="easyui-linkbutton" style="width: 8%;"
				 data-options="onClick:orderSaveBusinessWhere"iconCls="icon-search">查询</a> 			
		</div>    
			<table class="easyui-datagrid" style="width: 100%;height:300px;" id="SupplierBusiness_list_tabs"		
				data-options="url:'get_SupplierBusiness',fitColumns:true,pagination:true,rownumbers: true,singleSelect:true,onDblClickRow:selectSupplierBusiness">
				<thead>
					<tr>
						<th style="width:30%" data-options="field:'busName'">名称</th>
						<th style="width:30%" data-options="field:'busAddress'">地址</th>
						<th style="width:25%" data-options="field:'busPhone'">固定电话</th>
						<th style="width:15%" data-options="field:'busType'">类型</th>		
					</tr>
				</thead>
			</table>
		</div> 			
	</div>
	<div id="checkedEplan_select" class="easyui-window" title="选择计划"
			data-options="collapsible:false,minimizable:false,maximizable:false,modal:true,iconCls:'icon-add',closed:true"
			style="width: 800px; height: 400px; padding: 5px;">
		<div style="margin-left: 5px;">
		<div style="margin: 10px">
			<select class="easyui-combobox" label="采购类型" style="width: 25%;"
				id="orderSave_eplanType" data-options="panelHeight: 'auto'">
				<option value="批次采购">批次采购</option>
				<option value="补货采购">补货采购</option>
			</select> 
			<input id="orderSave_eplanDate" style="width: 25%;" class="easyui-datebox" label="申请日期"> 
			<select id="orderSave_eplanDept" style="width:25%;" class="easyui-combotree" label="采购科室" 
					data-options="url:'to_QueryAllOffice',panelHeight: 'auto',valueField:'text'">		
			</select>	
			<a href="#" class="easyui-linkbutton" style="width: 8%;"
				 data-options="onClick:orderSaveEquiplanWhere" iconCls="icon-search">查询</a>
		</div>
			<table class="easyui-datagrid" style="width: 100%;height:300px;" id="CheckedEplan_list_tabs"		
				data-options="url:'get_CheckedEplan',fitColumns:true,pagination:true,rownumbers: true,singleSelect:true,onDblClickRow:selectCheckedEplan">
				<thead>
					<tr>
						<th style="width: 25%" data-options="field:'eplanTitle'">主题</th>
						<th style="width: 15%" data-options="field:'eplanType'">采购类型</th>
						<th style="width: 15%" data-options="field:'eplanAuthor'">制定人</th>
						<th style="width: 15%" data-options="field:'eplanDept'">科室</th>
						<th style="width: 15%" data-options="field:'eplanDate'">采购日期</th>
						<th style="width: 15%" data-options="field:'eplanState'">状态</th></tr>
				</thead>
			</table>
		</div> 			
	</div>
	  
	<div id="tt" class="easyui-tabs" style="width:100%;height:40%" border="0">   
    <div title="订单详情" style="padding:10px;display:none;">
       <table class="easyui-datagrid" style="width: 99%;height:300px" id="order_equip_detail_tabs"
			data-options="url:'',fitColumns:true,singleSelect:true,pagination:true">
			<thead>
				<tr>
					<th style="width: 40%;" data-options="field:'edetailName3'">采购设备器材名</th>
					<th style="width: 15%;" data-options="field:'edetailNum'">数量</th>
					<th style="width: 15%;" data-options="field:'edetailUnit'">单位</th>
					<th style="width: 30%;" data-options="field:'edetailType'">类型</th>
				</tr>
			</thead>
		</table>
           <div style="margin: 5px 3px;">
					<a href="#" class="easyui-linkbutton" iconCls="icon-save"
					data-options="onClick:saveEquipOrder">确认</a>
			</div>
    </div>
			<div title="供应商详情" data-options="closable:true"
				>
				<table width="100%" border="0" style="padding: 6px;">
					<tr>
						<td width="50%"><input class="easyui-textbox" type="text"
							readonly="readonly" id="order_bus_name" label="供应商名称"
							style="width: 50%" /></td>
						<td width="50%"><input class="easyui-textbox" type="text"
							readonly="readonly" label="固定电话" style="width: 50%"
							id="order_bus_phone" /></td>
					</tr>
					<tr>
						<td width="50%"><input style="width: 50%;"
							readonly="readonly" class="easyui-textbox" label="类型"
							id="order_bus_type"></td>
						<td width="50%"><input class="easyui-textbox" label="地址"
							readonly="readonly" name="business.busAddress" style="width: 50%"
							id="order_bus_address" /></td>
					</tr>
				</table>
				<div class="easyui-panel" title="联系人信息" border="false" fit="true"
					style="margin: 5px">
					<table style="width: 100%;" id="order_business_people_tabs"
						class="easyui-datagrid"
						data-options="
					fitColumns: true, nowrap: false,rownumbers: true,border: false,rownumbers: true">
						<thead>
							<tr>
								<th style="width: 30%;" data-options="field:'bpeoName'">姓名</th>
								<th style="width: 35%;" data-options="field:'bpeoPhone'">电话</th>
								<th style="width: 35%;" data-options="field:'bpeoEmil'">邮箱</th>
							</tr>
						</thead>
					</table>
				</div>
			</div>		
		</div>  
		</form>
</div>
</body>
</html>